package com.etsoft.comm.db;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 整个类只需要创建一个对象，设计成单例模式
 * MyProperties
 */
public class Conf extends Properties {
	private static final long serialVersionUID = 1L;
	
	private static Conf myProperties;

    private Conf() {
        InputStream in = Conf.class.getClassLoader().getResourceAsStream("config.properties");
        try {
            this.load(in);
        } catch (Exception e) {
            System.out.println("properties read error");
            System.exit(0);
        }
    }

    public static Conf getInstance() {
        if(null == myProperties){
            myProperties = new Conf();
        }
        return myProperties;
    }

    public static String getByKey(String k) {
        return getInstance().getProperty(k);
    }
}